/**
 *
 */
package com.geetour.columbus.core.mail;

import java.util.Properties;

import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

/**
 * @author ChenKai
 */
public class EmailAppConfig {

	private String emailHost;
	private String userName;
	private String password;
	private String mailAuth;

	public String getEmailHost() {
		return emailHost;
	}

	public void setEmailHost(String emailHost) {
		this.emailHost = emailHost;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getMailAuth() {
		return mailAuth;
	}

	public void setMailAuth(String mailAuth) {
		this.mailAuth = mailAuth;
	}

	// JavaMailSender用来发送邮件的类
	public JavaMailSender mailSender() {
		JavaMailSenderImpl ms = new JavaMailSenderImpl();
		System.out.println("=============" + emailHost);
		System.out.println("=============" + userName);
		System.out.println("=============" + password);
		System.out.println("=============" + mailAuth);
		ms.setHost(emailHost);
		ms.setUsername(userName);
		ms.setPassword(password);
		Properties pp = new Properties();
		pp.setProperty("mail.smtp.auth", mailAuth);
		ms.setJavaMailProperties(pp);
		return ms;
	}
}
